home *** CD-ROM | disk | FTP | other *** search
- Path: news.iwl.net!usenet
- From: "Gary L. Grobe" <glgrobe@iwl.net>
- Newsgroups: comp.lang.c++
- Subject: STL - is it remotly possible
- Date: Sat, 13 Apr 1996 00:59:59 -0500
- Organization: A poorly-installed InterNetNews site
- Message-ID: <316F42DF.42F4@iwl.net>
- NNTP-Posting-Host: p168.iwl.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- I'm looking for help & suggestions. (Using STL's sequence containers).
- Is this even slightly correct. It was intended to be read as, create an element in the root
- list(Library)that points to an object(BookCase) which contains several lists(the books). A
- tree with many roots. Everything should be dynamic. Of course it doesn't work, but I think it
- will give an idea of what I'm trying to accomplish.
- -----
- class Sci_Fi {
- int no;
- public:
- Sci_Fi *sci; /* ... */
- };
- class Western {
- int no;
- public:
- Western *west; /* ... */
- };
- class BookCase { /* same format as above */ };
- class Library { /* same format as above */ };
-
- typedef list<Sci_Fi*> SFBooks[]; // to be contained in BookCases
- typedef list<Western*> WBooks[]; // to be contained in BookCases
- typedef list<Sci_Fi**, Western**> BookCases[]; to contain books
- typedef list<BookCases*> Library[]; // each elem of this lst -> to a bookcase
-
- void creat_Lib(int no_sfb, int no_wb) {
- SFBooks sfb(no_sfb);
- Western wb(no_wb);
- BookCases book_case;
- Library lib;
-
- book_case.push_back(sfb);
- book_case.push_back(wb);
-
- lib.push_back(book_case);
- };
-
- Sci_Fi::Sci_Fi(int n) {
- sci = new Sci_Fi[n];
- }
- Western::Western(int n) {
- west = new Western[n];
- }
- BookCase::BookCase() {
- bcase = new BookCase;
- }
- Library::Library() {
- lbry = new Library;
- }
- -------
- Thanks in advance,
-